<div class="smart-rightPanel layui-form">
    <div class="layui-anim layui-anim-upbit">
        <blockquote class="site-text layui-elem-quote">

        </blockquote>
        <table id="list_table" class="layui-hide" lay-filter="mainList"></table>
    </div>
</div>
<script>
    layui.use(['layer', 'table', 'form','jquery'], function () {
        var layer = layui.layer;
        var table = layui.table;
        var form = layui.form;
        var  $ = layui.jquery;
        var tableObj = table.render({
            id: 'list_table'
            , elem: '#list_table'
            , url: 'buss/task/log'
            , where:{id:getHashParam().id}
            , align: "center"
            , cols: [[ //表头
                {type: 'checkbox'}
                , {field: 'id', title: '编号',align: 'center',hide:true}
                , {field: 'taskName', title: '任务名', width: 140, align: 'center' , templet: function (d) {
                        return '<a class="font-primary" href="views/index.html#/buss/task/list[id='+d.taskId+']">'+d.taskName+'</a>'
                    }}
                , {field: 'userName', title: '用户名', width: 140, align: 'center' , templet: function (d) {
                        return '<a class="font-primary" href="views/index.html#/buss/user/list[id='+d.userId+']">'+d.userName+'</a>'
                    }}
                , {field: 'checkStatus', title: '审核状态', width: 140, align: 'center'
                    , templet: function (d) {
                    if(d.checkStatus==1){
                        return '审核通过';
                    }else if(d.checkStatus==2){
                        return '审核失败';
                    }else {
                        return '未审核';
                    }
                    }}
                , {field: 'imgUpload', title: '截图', width: 140, align: 'center' , templet: function (d) {
                        if(!d.imgUpload){
                            return '';
                        }
                        var arr=d.imgUpload.split(',')
                        return '<div><img src="'+arr[0]+'" style="width: 40px;height: 40px"></div>';
                    }}
                , {field: 'userPrice', title: '用户奖励', width: 140, align: 'center'  , templet: function (d) {
                        if(d.checkStatus!=1){
                            return '0';
                        }else {
                            return d.userPrice;
                        }
                    }}
                , {field: 'remarks', title: '备注', width: 140, align: 'center' }
                , {field: 'lock', title: '操作', width: 140, templet: function (d) {
                        return '<button class="layui-btn layui-btn-warm layui-btn-sm" lay-event="edit">详情</button>';
                    }, unresize: true, align: 'center'}
            ]]
            , done :function(res,curr,count){
                $(".layui-table-box").find("[data-field='id']").css("display","none");
            }
        });

        $("#search").click(function () {
            reloadTable(tableObj);
        });



        //表格内部操作按钮监听
        table.on('tool(mainList)', function (obj) {
            var data = obj.data;
            var layEvent = obj.event;
            if (layEvent === 'edit') {
                showDialog({
                    title: '修改',
                    template: 'edit1',
                    saveUrl: 'buss/task/log/save',
                    tableObj: tableObj,
                    htmlData: data,
                    width : 1000
                })
            }
        });


    });
</script>

